package com.mall.canal.job;

import com.mall.canal.spring.SpringContext;
import com.mall.page.feign.SeckillPageFeign;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author Darren
 * @date 2022-10-08 10:35
 * Description：
 */
@Component
public class SeckillActivityJob implements SimpleJob {
    /**
     * 不知道为什么有Component但是注入不了
     */
//    @Autowired
//    private SeckillPageFeign seckillPageFeign;

    @Override
    public void execute(ShardingContext shardingContext) {
        SeckillPageFeign seckillPageFeign = SpringContext.getBean(SeckillPageFeign.class);
        seckillPageFeign.deleteByActId(shardingContext.getJobParameter());
        System.out.println("=====删除秒杀商品静态页成功=====");
    }
}
